import * as types from "../../mutation-type";

export const globalState = {
    token: "",
    userInfo: "",
    assemblySize: "middle",
    language: "",
    themeConfig: {
        // 默认 primary 主题颜色
        primary: "#18ffb6",
        // 深色模式
        isDark: false,
        // 色弱模式(weak) || 灰色模式(gray)
        weakOrGray: "",
        // 面包屑导航
        breadcrumb: true,
        // 标签页
        tabs: true,
        // 页脚
        footer: true
    }
};

const global = (state = globalState, action) => {
    switch (action.type) {
        case types.SET_TOKEN:
            return {...state,token: action.token }
        case types.SET_ASSEMBLY_SIZE:
            return {...state,assemblySize: action.assemblySize }
        case types.SET_LANGUAGE:
            return {...state,language: action.language }
        case types.SET_THEME_CONFIG:
            return {...state,themeConfig: action.themeConfig }
        default:
            return state;
    }
}


export default global;